package com.xq.tmall.controller;

import com.xq.tmall.service.StockSectorService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;

@RequestMapping("/stockSectorCtrl")
@Slf4j
@Controller
public class StockSectorCtrl {

    @Resource
    private StockSectorService stockSectorService;

    @ApiOperation(value = "批量新增行业板块", notes = "批量新增行业板块")
    @ResponseBody
    @PostMapping(value = "/batchInsertSector")
    public String batchInsertSector(HttpServletRequest request, @RequestBody Map<String, Object> data) {
        try {
            //stockSectorService.batchInsert(data);

            stockSectorService.batchInserts(data);
            return "success";
        } catch (Exception e) {
            e.printStackTrace();
            return e.getMessage();
        }
    }
}
